package com.demo.example.water;

import java.util.Scanner;

public class TheMaxBit {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (scanner.hasNextInt()) { // 注意 while 处理多个 case
            int a = scanner.nextInt();
            int res=Integer.MIN_VALUE;
            int tmp=0;
            while(a!=0){
                if((a&1)==1){
                    a>>=1;
                    tmp++;
                    res=res>tmp?res:tmp;
                }else{
                    tmp=0;
                    res=res>tmp?res:tmp;
                    a>>=1;
                }
            }
            System.out.println(res);
        }
    }
}
